const { createClient } = require("redis");
const { REDIS_HOST, REDIS_PORT } = require("../server-env");
console.log('REDIS_PORT', REDIS_PORT)
let redisClient = createClient({
  host: REDIS_HOST, // 设置连接的IP地址
  port: REDIS_PORT, // 设置连接的端口号，默认为6379
  url: `redis://${REDIS_HOST}:${REDIS_PORT}`
})

redisClient.connect().catch(console.error)

// 连接到Redis服务器
redisClient.on('connect', () => {
  console.log('Connected to Redis server');
});

module.exports = redisClient;